﻿using System;

namespace ClassLibrary1
{
    public class CustomException : Exception
    {
        public CustomException(string message)
            : base(message)
        {
        }
    }

    public class Class4
    {
        public int ThrowArgumentException(int a, int b)
        {
            if (b <= a)
            {
                throw new ArgumentException("b must be greater than a");
            }
            return a + b;
        }

        public int ThrowCustomException(int a, int b)
        {
            if (b <= a)
            {
                throw new CustomException("b must be greater than a");
            }
            return a + b;
        }


        public int CatchCustomException(int a, int b)
        {
            try
            {
                return ThrowCustomException(a, b);
            }
            catch (CustomException ex)
            {
                Console.WriteLine(ex);
            }
            return 17;
        }
    }
}
